package com.hsmpay.mobile.service.user.impl;

import com.hsmpay.common.service.impl.BaseServiceSupport;
import com.hsmpay.mobile.dao.user.UserAddedDao;
import com.hsmpay.mobile.pojo.user.UserAdded;
import com.hsmpay.mobile.service.user.UserAddedService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户实名认证 userDPIService
 *
 * @param <Entity>
 * @param <Query>
 * @author 颜铃璋
 *         建立时间：2013-2-25
 */
@Service("userAddedService")
public class UserAddedServiceImpl extends BaseServiceSupport<UserAdded, Long> implements UserAddedService<UserAdded, Long> {
    @Resource(name = "userAddedDao")
    private UserAddedDao<UserAdded, Long> userAddedDao;

    /**
     * 修改 用户增值业务数据
     *
     * @param id
     * @param otherData
     * @return
     * @throws Exception
     */
    public int updateUserAddedById(Long id, String otherData) throws Exception {
        UserAdded userAdded = new UserAdded();
        userAdded.setId(id);
        userAdded.setOtherData(otherData);
        return userAddedDao.updateEntity(userAdded);
    }

    /**
     * 根据userId 修改
     *
     * @param userId
     * @param type
     * @return
     * @throws Exception
     */
    public UserAdded searchUserAddedByUserId(Long userId, Integer type) throws Exception {
        UserAdded userAdded = new UserAdded();
        userAdded.setUserId(userId);
        userAdded.setType(type);
        return userAddedDao.searchEntity(userAdded);
    }
}
